/*    */ package com.zimbra.qa.unittest;
/*    */ 
/*    */ import com.zimbra.cs.mime.Mime;
/*    */ import com.zimbra.cs.mime.MimeVisitor;
/*    */ import com.zimbra.cs.mime.MimeVisitor.ModificationCallback;
/*    */ import com.zimbra.cs.mime.MimeVisitor.VisitPhase;
/*    */ import javax.mail.MessagingException;
/*    */ import javax.mail.internet.MimeBodyPart;
/*    */ import javax.mail.internet.MimeMessage;
/*    */ import javax.mail.internet.MimeMultipart;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TestMimeVisitor
/*    */   extends MimeVisitor
/*    */ {
/*    */   protected boolean visitBodyPart(MimeBodyPart bp)
/*    */   {
/* 39 */     return false;
/*    */   }
/*    */   
/*    */   protected boolean visitMessage(MimeMessage mm, MimeVisitor.VisitPhase visitKind) throws MessagingException
/*    */   {
/* 44 */     if (visitKind != MimeVisitor.VisitPhase.VISIT_BEGIN) {
/* 45 */       return false;
/*    */     }
/* 47 */     String subject = Mime.getSubject(mm);
/* 48 */     if (subject.contains("oldsubject")) {
/* 49 */       if ((this.mCallback != null) && (!this.mCallback.onModification())) {
/* 50 */         return false;
/*    */       }
/* 52 */       mm.setSubject(subject.replaceAll("oldsubject", "newsubject"));
/* 53 */       mm.saveChanges();
/* 54 */       return true;
/*    */     }
/* 56 */     return false;
/*    */   }
/*    */   
/*    */   protected boolean visitMultipart(MimeMultipart mp, MimeVisitor.VisitPhase visitKind)
/*    */   {
/* 61 */     return false;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestMimeVisitor.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */